package edu.sctu.java.decorator;

public class CompressionDataSource extends DataSourceDecorator {


    public CompressionDataSource(DataSource dataSource) {
        super(dataSource);
    }

    private String compress(String data) {
        return "Compressed data";
    }

    private String decompress(String data) {
        return "Decompressed, " + data;
    }

    @Override
    public String read() {
        return decompress(super.read());
    }

    @Override
    public void write(String data) {
        super.write(compress(data));
    }
}
